package com.desay.pangoo.itmt.entity.rag;


import com.desay.pangoo.itmt.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.*;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * AI和用户的消息实体
 * @author uids1175
 */
@EqualsAndHashCode(callSuper = true)
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "rag_message")
@Data
@DynamicUpdate
@DynamicInsert
@Where(clause = "deleted=0")
public class MessageEntity extends BaseEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "message_id", columnDefinition = "bigint COMMENT '主键'")
    private Long messageId;

    @Column(name = "chat_id", columnDefinition = "bigint COMMENT '关联的消息会话'")
    private Long chatId;

    @Column(name = "content", columnDefinition = "text COMMENT '消息的文本内容'")
    private String content;

    @Column(name = "role", columnDefinition = "varchar(32) COMMENT '消息所属的角色，枚举值 ai,user'")
    private String role;

    @Column(name = "vote", columnDefinition = "tinyint COMMENT '仅当role=ai时有效，0--未操作 1--点赞 -1--点踩'")
    private Integer vote;

    @Column(name = "parent_id", columnDefinition = "bigint COMMENT '该条消息的父Id'")
    private Long parentId;

    @Column(name = "like_comment", columnDefinition = "varchar(1024) COMMENT '这条消息的'")
    private String likeComment;

    @Column(name = "dislike_comment", columnDefinition = "varchar(1024) COMMENT '该条消息的父Id'")
    private String dislikeComment;

    @Column(name = "deleted", columnDefinition = "tinyint default 0 COMMENT '标识记录是否删除，0标识未删除，1标识删除'")
    private Integer deleted;

    @Column(name = "is_summary", columnDefinition = "tinyint default 0 COMMENT '标识记录是否是总结内容的消息，0表示否 1表示是'")
    private Integer isSummary;


}
